(SST) ShlWAPI.pas Version 1.08

Developer Reference
(SST)ShlWAPI PathFindNextComponent Function
Returns the next component of a path string.
Scope
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas).
Syntax
function PathFindNextComponent(pszPath : LPCSTR) : LPSTR;
Parameters
pszPath [in] Pointer to a null-terminated, path string, with a length that does not exceed MAX_PATH (= 260) characters (including the the terminating null character).
Return Values
If the function succeeds it, returns a pointer to the path from the first backslash after the root to the end of the input string. If the function fails, the returned pointer is NIL.
Example
PROCEDURE TForm4.TestShlWAPIPathFindNextComponent(Sender : TObject); VAR pathcomponents : STRING; VAR nextcomponentp : PChar; VAR newinfoline : STRING; BEGIN pathcomponents := ''; nextcomponentp := NIL; newinfoline := ''; pathcomponents := 'C:\Hello\Windows\World'; newinfoline := 'PathFindNextComponent called with ' + pathcomponents; Memo1.Lines.Add(newinfoline); nextcomponentp := PathFindNextComponent(PChar(pathcomponents)); newinfoline := nextcomponentp; Memo1.Lines.Add(newinfoline); pathcomponents := nextcomponentp; newinfoline := 'PathFindNextComponent called with ' + pathcomponents; Memo1.Lines.Add(newinfoline); nextcomponentp := PathFindNextComponent(PChar(pathcomponents)); newinfoline := nextcomponentp; Memo1.Lines.Add(newinfoline); pathcomponents := 'Hello/Unix/World'; nextcomponentp := NIL; newinfoline := 'PathFindNextComponent called with ' + pathcomponents; Memo1.Lines.Add(newinfoline); nextcomponentp := PathFindNextComponent(PChar(pathcomponents)); IF ((nextcomponentp <> NIL) AND (nextcomponentp^ <> #0)) THEN newinfoline := nextcomponentp ELSE newinfoline := 'NIL'; Memo1.Lines.Add(newinfoline); Memo1.Lines.Add(''); END;
The above example produces the following output:
PathFindNextComponent called with C:\Hello\Windows\World Hello\Windows\World PathFindNextComponent called with Hello\Windows\World Windows\World PathFindNextComponent called with Hello/Unix/World NIL
Requirements
Unit: Declared and imported in (SST)ShlWAPI.pas
Library: (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj
Unicode: Implemented as ANSI (PathFindNextComponent and PathFindNextComponentA) and Unicode (PathFindNextComponentW) functions.
Min. ShlWAPI.dll version according to MS SDK doc.: 4.71
Min. ShlWAPI.dll version based on SST research: 4.71
Min. OS version(s) according to Microsoft SDK doc.: Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
Min. OS version(s) according to SST research.: Windows NT 4.0 with IE 4.0, Windows 95 with IE 4.0, Windows 98, Windows 2000 and later
See Also
PathFindSuffixArray, PathGetArgs
 
Windows APIs: PathFindNextComponent, PathFindFileName, PathFindExtension, PathFindSuffixArray, PathGetArgs


Document/Contents version 1.00
Page/URI last updated on 07.12.2023
 
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017
Suggestions and comments mail to:
webmaster@stoelzelsoftwaretech.com